<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../0js/vue.js"></script>
</head>
<body>

<div id="root">
    <h2>今天天气很好{{info}}, {{i}}</h2>
    <button @click="changeWeather">切换天气</button>
<!--    <button @click="isHot = !isHot">切换天气</button>-->
</div>

<script type="text/javascript">
    // 阻止vue在启动时生成生产提示
    Vue.config.productionTip = false

    const vm = new Vue({
        el:"#root",
        data: {
            isHot: true,
            i: 0
        },
        computed: {
            info() {
                return this.isHot ? "炎热" : "凉爽"
            }
        },
        methods: {
            changeWeather() {
                this.isHot = !this.isHot
                this.i++

                let self = this

                let function1 = new Function("return !vm.isHot");

                console.log(function1())

            }
        }
    });

</script>
</body>
</html>